//
//  KeyboardTextAttachment.swift
//  customKeyboard
//
//  Created by changhongliang on 2017/8/15.
//  Copyright © 2017年 richinfo. All rights reserved.
//

import UIKit

class KeyboardTextAttachment: NSTextAttachment {
    /// 当前图片对应的字符串名称
    var chs: String?
    init(emoticon:KeyboardEmoticon,font:UIFont){
        super.init(data: nil, ofType: nil)
        self.image = UIImage(contentsOfFile: emoticon.imagePath ?? "")
        let s = font.lineHeight
        self.bounds = CGRect(x: 0, y: -4, width: s, height: s)
        chs = emoticon.chs
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
